<?php
session_start();

include "webmaster_connect.php";

$page_permission = 2;

include "webmaster_check_login.php";

$message_id = $_POST['id'];

mysql_query("UPDATE customer_messages SET 

message_status = 'Read'

WHERE id = $message_id");

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<style type="text/css">
body {
	background-image: url(../images/wood.jpg);
	background-repeat: repeat-x;
	margin: 0px;
	background-position: left top;
	background-attachment: fixed;
	background-color: #000000;
	padding-top: 0px;
	padding-right: 0px;
	padding-bottom: 0px;
	padding-left: 0px;
}
</style>
<link href="../css/webmaster_view_customer_messages.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
</script>
</head>

<body>

<div id="page_container">

<?php 

include "../admin_files/webmaster_header.php";
include "../admin_files/webmaster_navigation.php" 

?>

<div id="content_container">

<input name="back" type="button" class="save_button" onclick="MM_goToURL('parent','webmaster_customer_messages.php');return document.MM_returnValue" value="Back to messages" />

<h1>Viewing customer message #<?php echo $_POST['id'] ?></h1>

<?php

$query = "SELECT * FROM customer_messages WHERE id = $message_id";

$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{

$product_id = $row['product_id'];	
$customer_name = $row['customer_name'];	
$customer_email = $row['customer_email'];	
$customer_number = $row['customer_number'];
$message = $row['contact_message'];	
$product_id = $row['product_id'];	
}

?>

<form action="" method="post" name="read_message" id="read_message">

<h2>Customer details</h2>

<input name="customer_name" type="text" value="<?php echo $customer_name ?>" />
<input name="customer_number" type="text" value="<?php echo $customer_number ?>" />
<input name="customer_email" type="text" value="<?php echo $customer_email ?>" />

<h2>Message details</h2>

<textarea name="message" cols="" rows="" class="description_box"><?php echo $message ?></textarea>

<h2>Product details</h2>

<input name="product_id" type="text" value = "<?php echo $product_id ?>"/>

</form>

</div>

</div> 
<!--page_container-->

</body>
</html>

